package com.jjwt.demo;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class ListDemo {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
//第二步：输入x变量
        System.out.println("请输入x的值：");

        List<Integer> integerList=new ArrayList<>();
        for (int i=0;i<10;i++){
            integerList.add(scanner.nextInt());
        }
        System.out.println("-------------------降序--------------");
        integerList.sort(Collections.reverseOrder());//这是个降序
        for (Integer integer : integerList) {
            System.out.println("integer = " + integer);
        }
        System.out.println("-----------------------升序---------------");
        integerList.sort(null);
        for (Integer integer : integerList) {
            System.out.println("integer = " + integer);
        }
    }


}
